namespace RIS.TMP.WEB.APP.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class AllContext9 : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.MRSaveRestore", "MRPId", "dbo.MRPoint");
            DropForeignKey("dbo.MRSaveRestore", "ReId", "dbo.MRestoreToRepair");
            DropForeignKey("dbo.MRSaveRestore", "ResId", "dbo.MRestoreToAdmin");
            DropIndex("dbo.MRSaveRestore", new[] { "MRPId" });
            DropIndex("dbo.MRSaveRestore", new[] { "ReId" });
            DropIndex("dbo.MRSaveRestore", new[] { "ResId" });
            AlterColumn("dbo.MRSaveRestore", "ReId", c => c.Int());
            AlterColumn("dbo.MRSaveRestore", "ResId", c => c.Int());
            AlterColumn("dbo.MRSaveRestore", "MRPId", c => c.Int());
            AddForeignKey("dbo.MRSaveRestore", "MRPId", "dbo.MRPoint", "MRPId");
            AddForeignKey("dbo.MRSaveRestore", "ReId", "dbo.MRestoreToRepair", "ReId");
            AddForeignKey("dbo.MRSaveRestore", "ResId", "dbo.MRestoreToAdmin", "ResId");
            CreateIndex("dbo.MRSaveRestore", "MRPId");
            CreateIndex("dbo.MRSaveRestore", "ReId");
            CreateIndex("dbo.MRSaveRestore", "ResId");
        }
        
        public override void Down()
        {
            DropIndex("dbo.MRSaveRestore", new[] { "ResId" });
            DropIndex("dbo.MRSaveRestore", new[] { "ReId" });
            DropIndex("dbo.MRSaveRestore", new[] { "MRPId" });
            DropForeignKey("dbo.MRSaveRestore", "ResId", "dbo.MRestoreToAdmin");
            DropForeignKey("dbo.MRSaveRestore", "ReId", "dbo.MRestoreToRepair");
            DropForeignKey("dbo.MRSaveRestore", "MRPId", "dbo.MRPoint");
            AlterColumn("dbo.MRSaveRestore", "MRPId", c => c.Int(nullable: false));
            AlterColumn("dbo.MRSaveRestore", "ResId", c => c.Int(nullable: false));
            AlterColumn("dbo.MRSaveRestore", "ReId", c => c.Int(nullable: false));
            CreateIndex("dbo.MRSaveRestore", "ResId");
            CreateIndex("dbo.MRSaveRestore", "ReId");
            CreateIndex("dbo.MRSaveRestore", "MRPId");
            AddForeignKey("dbo.MRSaveRestore", "ResId", "dbo.MRestoreToAdmin", "ResId", cascadeDelete: true);
            AddForeignKey("dbo.MRSaveRestore", "ReId", "dbo.MRestoreToRepair", "ReId", cascadeDelete: true);
            AddForeignKey("dbo.MRSaveRestore", "MRPId", "dbo.MRPoint", "MRPId", cascadeDelete: true);
        }
    }
}
